//
//  MineTableViewController.m
//  HaiGoumerMerchant
//
//  Created by apple on 17/1/20.
//  Copyright © 2017年 com.zaoguankeji.www. All rights reserved.
//

#import "MineTableViewController.h"

#import "StorInfoTableViewCell.h"
#import "STTipsBackVC.h"
static   NSString  *cellID = @"StorInfoTableViewCell";

@interface MineTableViewController ()
@property(nonatomic, strong) NSMutableArray *dataArr;
@end

@implementation MineTableViewController
#pragma mark -----------dataArr-------------------懒加载;
- (NSMutableArray *)dataArr{
    if (!_dataArr) {
        self.dataArr = [NSMutableArray array];
    }
    
    return _dataArr;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"设置";
    [self.tableView registerNib:[UINib nibWithNibName:cellID bundle:nil ]forCellReuseIdentifier:cellID];
   self.dataArr = @[@"44",@"55"];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    
    return 3;
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    switch (section ) {
        case 0:
            return self.dataArr.count > 0?self.dataArr.count:0;
            break;
        
        default:
            return [super tableView:tableView numberOfRowsInSection:section];
            break;
    }
}

- (NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.section == 0) {
        NSIndexPath *indexp = [NSIndexPath indexPathForRow:0 inSection:0];
        return [super tableView:tableView indentationLevelForRowAtIndexPath:indexp];
    }

    return  [super tableView:tableView indentationLevelForRowAtIndexPath:indexPath];
}
#pragma mark - Table view data source

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 30;
    
}

- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
  
    switch (section) {
        case 0:
            return @"我的店铺";
            break;
        case 1:
            return @"系统设置";
            break;
        case 2:
            return @"";
            break;
        default:
            return @"";
            break;
    }

    return @"我的设置";
}
- (CGFloat )tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    return 0;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    if (indexPath.section == 0) {
         UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"StorInfoTableViewCell" forIndexPath:indexPath];
        return  cell;
    }
   
    
  
    return  [super tableView:tableView cellForRowAtIndexPath:indexPath];
    
}


- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {

    if(indexPath.section == 0) {
        return 44;
    }
    
    return [super tableView:tableView heightForRowAtIndexPath:indexPath];
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
 
    if (indexPath.section == 1) {
        switch (indexPath.row) {
            case 1: {
                //反馈意见
                STTipsBackVC *tipVC = [[UIStoryboard storyboardWithName:@"TipBack" bundle:nil]instantiateViewControllerWithIdentifier:@"STTipsBackVC"];
                tipVC.hidesBottomBarWhenPushed = YES;
                [self.navigationController pushViewController:tipVC animated:YES];
            }
                break;
                
            default:
                break;
        }
    }
   
}
@end
